package LeetCode;
import java.util.*;
public class No78 {
    public static void main(String[] args) {
        int[] a ={1,2,3};
        subsets(a);
    }

    public static List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> list = new ArrayList<>();
        List<Integer> list1 = new ArrayList<>();
        int n = 0;
        deepSeek(list,list1,n,nums);
        System.out.println(list);
        return list;
    }

    public static void deepSeek(List<List<Integer>> list,List<Integer> list1,int n,int[] nums){
        if(n==nums.length){
            list.add(new ArrayList<Integer>(list1));
            return ;
        }
        list1.add(nums[n]);
        deepSeek(list,list1,n+1,nums);
        list1.remove(list1.size()-1);
        deepSeek(list,list1,n+1,nums);
    }
}
